package com.sscaipiao.android.activity.Base;

import android.os.Bundle;
import android.util.Log;
import android.widget.SimpleAdapter;
import com.sscaipiao.android.R;
import com.sscaipiao.android.common.Constants;

import java.util.HashMap;
import java.util.Map;

public class Item1HistoryActivity extends NormalHistoryActivity implements NormalHistoryActivity.onLoacHistoryCallback {

	private String[] mFrom = new String[]{"tv_season","tv_ball_ids","tv_date"};

	private int[] mTo = new int[]{R.id.tv_season, R.id.tv_ball_ids, R.id.tv_date};
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setCallback(this);
	}

	@Override
	public void onResume() {
		super.onResume();
	}

	private void setupListData() {
		if (history != null) {
			Map<String, Object> mMap = null;
			Log.v("history", history.size() + "");
			for (int j = 0; j < history.size(); j++) {
				mMap = new HashMap<String, Object>();
				String[] split = history.get(j).split(Constants.STRING_SPLITE_COMPLEX);
				mMap.put("tv_season", "第" + split[0] + "期 :");
				mMap.put("tv_ball_ids", split[1]);
				mMap.put("tv_date", split[3]);
				mList.add(mMap);
			}
			SimpleAdapter mAdapter = new SimpleAdapter(this, mList,
					R.layout.single_array_ball_his_item,
					mFrom, mTo);
			setHistoryListAdapter(mAdapter);
		}
	}


	@Override
	public void onLoad() {
		setupListData();
	}
}
